package main

import "fmt"

type rect struct {
	width, height int
}

func (r *rect) area() int  {
	return r.width * r.height
}

func (r rect) perim() int  {
	return 2*r.width + 2*r.height
}



func main()  {
	//初始化r对象
	r := rect{width:10,height:5}
	fmt.Println("area:",r.area())
	fmt.Println("perim:", r.perim())

	//复制对象并重新复制
	rp := &r
	rp.height=6
	fmt.Println("area:",rp.area())
	fmt.Println("perim:", rp.perim())

}